#region File header
// Project: SharpWars.Core, File: Player.cs
// Namespace: SharpWars.Core.Network, Class: Player
// Path: F:\Coder\Projekty\Windows\Gry\SharpWars\SharpWars.Core\Network, Author: Sebastian Haba (sho@gisz.net.pl)
// Code lines: 160, Size of file: 2,60 KB
// Creation date: 2007-02-23 19:53
// Last modified: 2007-02-24 15:04
#endregion
#region Using directives
using System;
using System.Collections.Generic;
using System.Net.Sockets;
using System.Text;
#endregion

namespace SharpWars.Core.Network
{
	public class Player
	{
		private int playerID = 0;

		private Socket socket = null;

		private string name = string.Empty;

		private bool ready = false;
		
		private bool synchro = false;
		
		private bool save = false;

		private string remoteEndPoint = string.Empty;

		private List<Unit> unitsToSave = new List<Unit>();

		public int PlayerID
		{
			get
			{
				return this.playerID;
			}
			set
			{
				this.playerID = value;
			}
		}

		public Socket Socket
		{
			get
			{
				return this.socket;
			}
			set
			{
				this.socket = value;
			}
		}

		public string Name
		{
			get
			{
				return this.name;
			}
			set
			{
				this.name = value;
			}
		}

		public bool Ready
		{
			get
			{
				return this.ready;
			}
			set
			{
				this.ready = value;
			}
		}
		
		public bool Synchro
		{
			get
			{
				return this.synchro;
			}
			set
			{
				this.synchro = value;
			}
		}
		
		public bool Save
		{
			get
			{
				return this.save;
			}
			set
			{
				this.save = value;
			}
		}

		/// <summary>
		/// Remote end point
		/// </summary>
		/// <returns>String</returns>
		public string RemoteEndPoint
		{
			get
			{
				return this.remoteEndPoint;
			} // get
			set
			{
				this.remoteEndPoint = value;
			} // set
		} // RemoteEndPoint

		/// <summary>
		/// Units to save
		/// </summary>
		/// <returns>List</returns>
		public List<Unit> UnitsToSave
		{
			get
			{
				return this.unitsToSave;
			} // get
		} // UnitsToSave

		/// <summary>
		/// ==
		/// </summary>
		/// <param name="left">Left</param>
		/// <param name="right">Right</param>
		public static bool operator ==( Player left, Player right )
		{
			if( left.PlayerID == right.PlayerID &&
				left.Name == right.Name &&
				left.RemoteEndPoint == right.RemoteEndPoint )
			{
				return true;
			} // if (left.PlayerID)
			else
			{
				return false;
			} // else
		} // ==(left, right)

		/// <summary>
		/// Op inequality
		/// </summary>
		/// <param name="left">Left</param>
		/// <param name="right">Right</param>
		/// <returns>Bool</returns>
		public static bool operator !=( Player left, Player right )
		{
			if( left.PlayerID       != right.PlayerID ||
				left.Name           != right.Name ||
				left.RemoteEndPoint != right.RemoteEndPoint )
			{
				return true;
			} // if (left.PlayerID)
			else
			{
				return false;
			} // else
		} // op_Inequality(left, right)
	}
}
